use "${final}/LR_oisl.dta", clear


//regression 
label define treat_lb 0 "Pure Control" 1 "Placebo" 2 "Treatment"
label values treatment treat_lb

label var treatment_1 "Pure Control"
label var treatment_2 "Placebo"
label var treatment_3 "Treatment"



foreach x of varlist sum_* num_* any_*  {

	reg `x' treatment_2 treatment_3  i.strata age age2 female savings_base savings2_base  , cluster(id)

}

	est clear
	foreach var in any_mob sum_mob num_mob accountbalance new_loan  {
		eststo `var': reg `var' treatment_2 treatment_3	$controls i.strata
		summ `var' if treatment == 0
		estadd scalar mean=r(mean)
		test treatment_2 = treatment_3
		estadd scalar test = r(p)		
			
	}
	
	foreach var in  late_loan {
		eststo `var': reg `var' treatment_2 treatment_3	$controls i.strata if new_loan==1
		summ `var' if treatment == 0
		estadd scalar mean=r(mean)
		test treatment_2 = treatment_3
		estadd scalar test = r(p)		
			
	}
	
		esttab any_mob sum_mob num_mob accountbalance late_loan new_loan  using "${output}/LR.tex", replace /*
	*/	   sfmt(%12.3fc) number booktabs f b(3) se(3) label depvars/*
	*/	   star(* 0.1 ** 0.05 *** 0.01)							/*
	*/	   keep(treatment_2 treatment_3 ) /*
	*/	   order(treatment_2 treatment_3 )/*	
	*/	   coeflabel(treatment_2 		"Saving" /*
	*/				 treatment_3 		"Mobile Banking")/*
	*/	   mtitles("Any use" "Value transactions" "Number transactions" "Saving"  "Late loan" "New loan" ) /*
	*/     collabels(none) compress /*
	*/	   scalars("N Observations" "mean Control Mean" /*
	*/			   "test p-value Saving = MB" )   




